

import 'package:flutter/material.dart';
import 'transfer_data_entity.dart';

//所有的子组件共享数据
class IDataProvider extends InheritedWidget{

  final TransferDataEntity data;

  IDataProvider({Widget child,this.data}):super(child:child);


  @override
  bool updateShouldNotify(IDataProvider oldWidget) {
    return data!=oldWidget.data;
  }

  //版本问题
  //InheritedWidget
  static IDataProvider of(BuildContext context){
    return context.dependOnInheritedWidgetOfExactType<IDataProvider>();
  }

// static _InheritedProviders of(BuildContext context) {
//   final widget = context.inheritFromWidgetOfExactType(_InheritedProviders);
//   return widget is _InheritedProviders ? widget : null;
// }

}